package com.wawei.seeds;

import android.app.Application;
import android.support.v4.util.LruCache;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool;
import com.bumptech.glide.load.engine.cache.LruResourceCache;

import java.io.Serializable;

/**
 *
 * Created by parker on 15/6/7.
 */
public class SeedsApp extends Application {
    public static final String LOGIN_USER = "login_user";
    public static final String LOGIN_TOKEN = "login_token";
    public static final String IS_EXPERT = "is_expert";
    public static final String CLIENT_ID = "client_id";

    private LruCache<String, Serializable> session = new LruCache<>(20);

    @Override
    public void onCreate() {
        super.onCreate();
        if(!Glide.isSetup()) {
            Glide.setup(new GlideBuilder(this)
                    .setMemoryCache(new LruResourceCache(20 * 1024 * 1024))
                    .setBitmapPool(new LruBitmapPool(20 * 1024 * 1024)));
        }
    }

    public LruCache<String, Serializable> getSession() {
        return session;
    }
}
